package com.student.demo.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

@Entity
public class ChengJi {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer fId;
	
	
	@OneToOne
	@JoinColumn(name="aId",unique=true)
	@NotFound(action=NotFoundAction.IGNORE)
    private Student student;
	
	
	@ManyToMany(mappedBy="chengJis",cascade=CascadeType.DETACH)
	private Set<Course> courses;
	
	
	
	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public Set<Course> getCourses() {
		return courses;
	}

	public void setCourses(Set<Course> courses) {
		this.courses = courses;
	}

	public Integer getfId() {
		return fId;
	}

	public void setfId(Integer fId) {
		this.fId = fId;
	}
	
}
